package com.zzx.day57Demo.Biz.impl;

import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.zzx.day57Demo.Biz.CraftBiz;
import com.zzx.day57Demo.DAO.CraftDAO;
import com.zzx.day57Demo.model.Craft;
@Service("craftBiz")
@Scope("prototype")
public class CraftBizImpl implements CraftBiz {
	private CraftDAO craftDAO;

	public void setCraftDAO(CraftDAO craftDAO) {
		this.craftDAO = craftDAO;
	}

	@Override
	public List<Craft> findAll() {
		
		return craftDAO.findAll();
	}

	@Override
	public void saveOrUpdate(Craft cra) {
		craftDAO.saveOrUpdate(cra);
		
	}

	@Override
	public Craft findById(int craId) {
		
		return craftDAO.findById(craId);
	}

	@Override
	public void delete(int craId) {
		craftDAO.delete(craftDAO.findById(craId));
		
	}

}
